<div class="action-buttons">
  <ion-button
    *ngIf="localPkg"
    expand="block"
    color="primary"
    [routerLink]="['/services', pkg.manifest.id]"
  >
    View Installed
  </ion-button>
  <ng-container *ngIf="localPkg; else install">
    <ng-container *ngIf="localPkg.state === PackageState.Installed">
      <ion-button
        *ngIf="(localVersion | compareEmver: pkg.manifest.version) === -1"
        expand="block"
        color="success"
        (click)="tryInstall()"
      >
        Update
      </ion-button>
      <ion-button
        *ngIf="(localVersion | compareEmver: pkg.manifest.version) === 1"
        expand="block"
        color="warning"
        (click)="tryInstall()"
      >
        Downgrade
      </ion-button>
      <ng-container *ngIf="showDevTools$ | async">
        <ion-button
          *ngIf="(localVersion | compareEmver: pkg.manifest.version) === 0"
          expand="block"
          color="success"
          (click)="tryInstall()"
        >
          Reinstall
        </ion-button>
      </ng-container>
    </ng-container>
  </ng-container>

  <ng-template #install>
    <ion-button expand="block" color="success" (click)="tryInstall()">
      Install
    </ion-button>
  </ng-template>
</div>
